#include "processingform.h"
#include "ui_processingform.h"
#include <QPainter>
#include <QStyleOption>

ProcessingForm::ProcessingForm(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::ProcessingForm)
{
    ui->setupUi(this);
    this->setProperty("form","backgroundform");
    ui->leftBorderForm->SetLabelIcon("processing");
    this->setFixedHeight(110);
}

ProcessingForm::~ProcessingForm()
{
    delete ui;
}

void ProcessingForm::UpdateShowType(int type)
{
    ui->leftBorderForm->UpdateShowType(type);
}

void ProcessingForm::paintEvent(QPaintEvent *event)
{
    QStyleOption opt;
    opt.init(this);
    QPainter painter(this);
    style()->drawPrimitive(QStyle::PE_Widget,&opt,&painter,this);
    QWidget::paintEvent(event);
}

void ProcessingForm::on_toolButton_leveling_clicked(bool checked)
{
    if(checked)
    {
        ui->toolButton_leveling->setIcon(QIcon(":/res/ProcessingForm/toolButton_leveling_checked.png"));
    }
    else
    {
        ui->toolButton_leveling->setIcon(QIcon(":/res/ProcessingForm/toolButton_leveling.png"));
    }
}

void ProcessingForm::on_toolButton_restore_clicked(bool checked)
{
    if(checked)
    {
        ui->toolButton_restore->setIcon(QIcon(":/res/ProcessingForm/toolButton_restore_checked.png"));
    }
    else
    {
        ui->toolButton_restore->setIcon(QIcon(":/res/ProcessingForm/toolButton_restore.png"));
    }
}

void ProcessingForm::on_toolButton_contractExpand_clicked(bool checked)
{
    ui->widget_hide->setHidden(!checked);
    if(checked)
        this->setFixedHeight(110);
    else
        this->setFixedHeight(50);
}
